<?php

class Default_Model_Table_SubPageContent extends Zend_Db_Table_Abstract {

    protected $_name = 'dynamic_content';

    public function getPageContent($page) {

        $select = $this->select();
        $select->order('id DESC')
                ->where('id_page=?', $page);
        $content = $this->_db->query($select)->fetchAll();
        return $content;
    }

    public function getPageContentType() {
        $select = $this->select();
        $select->order('id ASC')
                ->where('type=?', 'adress')
                ->limit('10');
        $Data = $this->_db->query($select)->fetchAll();
        return $Data;
    }

    public function getPhone() {
        $select = $this->select();
        $select->order('id ASC')
                ->where('type=?', 'phone')
                ->limit('10');
        $Data = $this->_db->query($select)->fetchAll();
        return $Data;
    }

    public function getUrls() {
        $select = $this->select();
        $select->order('id ASC')
                ->where('type=?', 'link')
                ->limit('10');
        $Data = $this->_db->query($select)->fetchAll();
        return $Data;
    }

    public function getAdressLimit($limit) {
        $select = $this->select();
        $select->order('id ASC')
                ->where('type=?', 'adress')
                ->limit($limit);
        $Data = $this->_db->query($select)->fetchAll();
        return $Data;
    }

    public function getPhoneLimit($limit) {
        $select = $this->select();
        $select->order('id ASC')
                ->where('type=?', 'phone')
                ->limit($limit);
        $Data = $this->_db->query($select)->fetchAll();
        return $Data;
    }

    public function getUrlsLimit($limit) {
        $select = $this->select();
        $select->order('id ASC')
                ->where('type=?', 'link')
                ->limit($limit);
        $Data = $this->_db->query($select)->fetchAll();
        return $Data;
    }

}

